package com.juc.forkJoinPool.forkJoinPool13;

import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;

public class Test2 {

	//pool.awaitTermination(10, TimeUnit.SECONDS) 要结合 pool.shutdown() 使用
	public static void main(String[] args) throws InterruptedException {
		MyRunnable1 myRunnable = new MyRunnable1();
		ForkJoinPool pool = new ForkJoinPool();
		pool.execute(myRunnable);
		pool.shutdown();
		System.out.println("main begin "+ System.currentTimeMillis());
		System.out.println(pool.awaitTermination(10, TimeUnit.SECONDS));
		System.out.println("main end "+ System.currentTimeMillis());
		//代码：pool.awaitTermination(10, TimeUnit.SECONDS) 作用
		//最多等待10秒 ，也就是阻塞10秒
	}
}
